import numpy as np
import cv2 as cv
import math
import os
import sys
sys.path.append(os.getcwd())
from config.env import Env
env = Env()

img = cv.imread(env.getImgPath() + 'meinv1.jpg', 0)

'''
改变尺寸、分辨率
'''
res = cv.resize(img,None,fx=2, fy=2, interpolation = cv.INTER_CUBIC)
#OR
height, width = img.shape[:2]
res = cv.resize(img,(2*width, 2*height), interpolation = cv.INTER_CUBIC)

print(res.shape)

'''
偏移图片
'''
rows,cols,ch = img.shape
M = np.float32([[1, 0 , 100], [0, 1, 50]])
print(ch)
dst = cv.warpAffine(img, M, (cols, rows))

'''
旋转图片/ 缩放图片
'''
dgree = 90
M2 = cv.getRotationMatrix2D(((cols - 1) / 2, (rows -1) / 2), dgree, 1)
dst = cv.warpAffine(img, M2, (cols, rows))

'''
三点位置转换
'''



cv.imshow("img", dst)
cv.waitKey(0)
cv.destroyAllWindows()